import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.Scanner;

public class Main{
        public static void main(String args[]) throws FileNotFoundException {
            Scanner scan =new Scanner(System.in);
            int ret=scan.nextInt();
            int min=0;
            int max=0;
            int count=Integer.MAX_VALUE;
            int ans1=0;
            int ans2=0;
            for(int i=2;i<ret;i++){
                int j=2;
                for(j=2;j<=i;j++){
                    if(i%j==0){
                        break;
                    }
                }
                if(j==i){
                    if(min==0&&max==0){
                        min=i;
                        max=i;
                    }
                    if(max>=min){
                        min=max;
                        max=i;
                    }
                    if(count>(max-min)&&(max+min)==ret){
                        count=max-min;
                        ans1=min;
                        ans2=max;
                    }
                }
            }
            System.out.println(ans1);
            System.out.println(ans2);
            String arr="hello";
            FileInputStream inputStream=new FileInputStream("arr");

        }
    public static void main1(String args[]) {
        Scanner scan = new Scanner(System.in);
        int ret = scan.nextInt();
        String arr = Integer.toString(ret, 2);
        int size = 0;
        if (arr.charAt(0) == '1') {
            size = 1;
        }

        int max = 0;
        for (int i = 0; i < arr.length() - 1; i++) {
            if (arr.charAt(i) == arr.charAt(i + 1) && arr.charAt(i) == '1') {
                if (arr.charAt(arr.length() - 1) == '1') {
                    size++;
                }
                size++;
            } else {
                if (size > max) {
                    max = size;
                    size = 0;
                }
            }
        }
        System.out.print(max);
    }
}